package net.wanho.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import net.wanho.po.Student;
import net.wanho.service.StudentService;
import net.wanho.vo.AjaxResult;
import org.springframework.web.bind.annotation.*;

/**
 * Author：汤小洋
 * Date：2023-07-27 15:20
 * Description：<描述>
 */
@Api(tags = "3.学生管理")
@RestController
@RequestMapping("/students")
@RequiredArgsConstructor
public class StudentController {

    private final StudentService studentService;

    @ApiOperation("分页查询")
    @GetMapping
    public AjaxResult findPage(@ApiParam("页码") int pagenum, @ApiParam("页大小") int pagesize, @ApiParam("查询条件") Student student){
        return AjaxResult.success(studentService.findPage(pagenum,pagesize,student));
    }

    @ApiOperation("根据id查询")
    @GetMapping("/{id}")
    public AjaxResult findById(@ApiParam("学生id") @PathVariable Long id){

        return AjaxResult.success();
    }

    @ApiOperation("新增")
    @PostMapping
    public AjaxResult add(@ApiParam("学生信息") @RequestBody Student student){

        return AjaxResult.success();
    }

    @ApiOperation("修改")
    @PutMapping
    public AjaxResult update(@ApiParam("学生信息") @RequestBody Student student){

        return AjaxResult.success();
    }

    @ApiOperation("删除")
    @DeleteMapping("/{id}")
    public AjaxResult delete(@ApiParam("学生id") @PathVariable Long id){

        return AjaxResult.success();
    }

}
